]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Pass orientation in constructor
authorAlexander Mikhaylenko <exalm7659@gmail.com>
Mon, 1 Mar 2021 16:53:55 +0000 (21:53 +0500)
committerMarge Bot <marge-bot@gnome.org>
Sat, 13 Mar 2021 18:08:24 +0000 (18:08 +0000)
When this class was written, all swipes in the shell were vertical, so it
made sense to make the default orientation vertical. This isn't the case
anymore, thus pass make it mandatory to specify orientation when creating
a tracker.

Change the property default values to horizontal as well to match Clutter
instead of the old shell design.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1731>

js/ui/appDisplay.js
js/ui/overview.js
js/ui/swipeTracker.js
js/ui/unlockDialog.js
js/ui/workspaceAnimation.js
js/ui/workspacesView.js

index 0c2b9759873463bfe42173a00201cde816aa4d2c..40122ad4b9a6aabda59c1e2eefc5e75d72bc51b0 100644 (file)
@@ -281,6 +281,7 @@ var BaseAppView = GObject.registerClass({
 
         // Swipe
         this._swipeTracker = new SwipeTracker.SwipeTracker(this._scrollView,
+            Clutter.Orientation.HORIZONTAL,
             Shell.ActionMode.OVERVIEW | Shell.ActionMode.POPUP);
         this._swipeTracker.orientation = Clutter.Orientation.HORIZONTAL;
         this._swipeTracker.connect('begin', this._swipeBegin.bind(this));
index 78736e513eb69f3f3516b53bc3be68b9290fab3f..355ef1dddf6961c15560e1fa22cef0434fc002f8 100644 (file)
@@ -240,6 +240,7 @@ var Overview = class {
             this.toggle.bind(this));
 
         const swipeTracker = new SwipeTracker.SwipeTracker(global.stage,
+            Clutter.Orientation.VERTICAL,
             Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
             { allowDrag: false, allowScroll: false });
         swipeTracker.orientation = Clutter.Orientation.VERTICAL;
index f62d5cd7d7ffa19538deac0bad5360f43b896436..a68e93b822b4c552127e394b84f5760eb656c644 100644 (file)
@@ -95,7 +95,7 @@ const TouchpadSwipeGesture = GObject.registerClass({
         'orientation': GObject.ParamSpec.enum(
             'orientation', 'orientation', 'orientation',
             GObject.ParamFlags.READWRITE,
-            Clutter.Orientation, Clutter.Orientation.VERTICAL),
+            Clutter.Orientation, Clutter.Orientation.HORIZONTAL),
     },
     Signals: {
         'begin':  { param_types: [GObject.TYPE_UINT, GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
@@ -220,7 +220,7 @@ const TouchSwipeGesture = GObject.registerClass({
         'orientation': GObject.ParamSpec.enum(
             'orientation', 'orientation', 'orientation',
             GObject.ParamFlags.READWRITE,
-            Clutter.Orientation, Clutter.Orientation.VERTICAL),
+            Clutter.Orientation, Clutter.Orientation.HORIZONTAL),
     },
     Signals: {
         'begin':  { param_types: [GObject.TYPE_UINT, GObject.TYPE_DOUBLE, GObject.TYPE_DOUBLE] },
@@ -316,7 +316,7 @@ const ScrollGesture = GObject.registerClass({
         'orientation': GObject.ParamSpec.enum(
             'orientation', 'orientation', 'orientation',
             GObject.ParamFlags.READWRITE,
-            Clutter.Orientation, Clutter.Orientation.VERTICAL),
+            Clutter.Orientation, Clutter.Orientation.HORIZONTAL),
         'scroll-modifiers': GObject.ParamSpec.flags(
             'scroll-modifiers', 'scroll-modifiers', 'scroll-modifiers',
             GObject.ParamFlags.READWRITE,
@@ -444,7 +444,7 @@ var SwipeTracker = GObject.registerClass({
         'orientation': GObject.ParamSpec.enum(
             'orientation', 'orientation', 'orientation',
             GObject.ParamFlags.READWRITE,
-            Clutter.Orientation, Clutter.Orientation.VERTICAL),
+            Clutter.Orientation, Clutter.Orientation.HORIZONTAL),
         'distance': GObject.ParamSpec.double(
             'distance', 'distance', 'distance',
             GObject.ParamFlags.READWRITE,
@@ -464,10 +464,11 @@ var SwipeTracker = GObject.registerClass({
         'end':    { param_types: [GObject.TYPE_UINT64, GObject.TYPE_DOUBLE] },
     },
 }, class SwipeTracker extends GObject.Object {
-    _init(actor, allowedModes, params) {
+    _init(actor, orientation, allowedModes, params) {
         super._init();
         params = Params.parse(params, { allowDrag: true, allowScroll: true });
 
+        this.orientation = orientation;
         this._allowedModes = allowedModes;
         this._enabled = true;
         this._allowLongSwipes = false;
@@ -480,7 +481,8 @@ var SwipeTracker = GObject.registerClass({
         this._touchpadGesture.connect('update', this._updateGesture.bind(this));
         this._touchpadGesture.connect('end', this._endTouchpadGesture.bind(this));
         this.bind_property('enabled', this._touchpadGesture, 'enabled', 0);
-        this.bind_property('orientation', this._touchpadGesture, 'orientation', 0);
+        this.bind_property('orientation', this._touchpadGesture, 'orientation',
+            GObject.BindingFlags.SYNC_CREATE);
 
         this._touchGesture = new TouchSwipeGesture(allowedModes,
             GESTURE_FINGER_COUNT,
@@ -490,7 +492,8 @@ var SwipeTracker = GObject.registerClass({
         this._touchGesture.connect('end', this._endTouchGesture.bind(this));
         this._touchGesture.connect('cancel', this._cancelTouchGesture.bind(this));
         this.bind_property('enabled', this._touchGesture, 'enabled', 0);
-        this.bind_property('orientation', this._touchGesture, 'orientation', 0);
+        this.bind_property('orientation', this._touchGesture, 'orientation',
+            GObject.BindingFlags.SYNC_CREATE);
         this.bind_property('distance', this._touchGesture, 'distance', 0);
         global.stage.add_action(this._touchGesture);
 
@@ -502,7 +505,8 @@ var SwipeTracker = GObject.registerClass({
             this._dragGesture.connect('end', this._endTouchGesture.bind(this));
             this._dragGesture.connect('cancel', this._cancelTouchGesture.bind(this));
             this.bind_property('enabled', this._dragGesture, 'enabled', 0);
-            this.bind_property('orientation', this._dragGesture, 'orientation', 0);
+            this.bind_property('orientation', this._dragGesture, 'orientation',
+                GObject.BindingFlags.SYNC_CREATE);
             this.bind_property('distance', this._dragGesture, 'distance', 0);
             actor.add_action(this._dragGesture);
         } else {
@@ -515,7 +519,8 @@ var SwipeTracker = GObject.registerClass({
             this._scrollGesture.connect('update', this._updateGesture.bind(this));
             this._scrollGesture.connect('end', this._endTouchpadGesture.bind(this));
             this.bind_property('enabled', this._scrollGesture, 'enabled', 0);
-            this.bind_property('orientation', this._scrollGesture, 'orientation', 0);
+            this.bind_property('orientation', this._scrollGesture, 'orientation',
+                GObject.BindingFlags.SYNC_CREATE);
             this.bind_property('scroll-modifiers',
                 this._scrollGesture, 'scroll-modifiers', 0);
         } else {
index 974600ae544559e8370b1a2e2a752799d92395cb..8ddae8b036355b73bbd9b2a5d4476947efd4751a 100644 (file)
@@ -495,8 +495,9 @@ var UnlockDialog = GObject.registerClass({
             this._setTransitionProgress(this._adjustment.value);
         });
 
-        this._swipeTracker = new SwipeTracker.SwipeTracker(
-            this, Shell.ActionMode.UNLOCK_SCREEN);
+        this._swipeTracker = new SwipeTracker.SwipeTracker(this,
+            Clutter.Orientation.VERTICAL,
+            Shell.ActionMode.UNLOCK_SCREEN);
         this._swipeTracker.connect('begin', this._swipeBegin.bind(this));
         this._swipeTracker.connect('update', this._swipeUpdate.bind(this));
         this._swipeTracker.connect('end', this._swipeEnd.bind(this));
index 6cac580e71b750ba1ba25d1636c1b6534b3dd15b..d240fe1562e887681403b310a96c2dea1149704a 100644 (file)
@@ -284,7 +284,9 @@ var WorkspaceAnimationController = class {
         });
 
         const swipeTracker = new SwipeTracker.SwipeTracker(global.stage,
-            Shell.ActionMode.NORMAL, { allowDrag: false });
+            Clutter.Orientation.HORIZONTAL,
+            Shell.ActionMode.NORMAL,
+            { allowDrag: false });
         swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this));
         swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this));
         swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));
index ba26006f764b954bf0a07ffc1d2629de07625597..757b5c3189d93541d73d317644e9c5b8f385d6df 100644 (file)
@@ -848,6 +848,7 @@ class WorkspacesDisplay extends St.Widget {
 
         this._swipeTracker = new SwipeTracker.SwipeTracker(
             Main.layoutManager.overviewGroup,
+            Clutter.Orientation.HORIZONTAL,
             Shell.ActionMode.OVERVIEW,
             { allowDrag: false });
         this._swipeTracker.allowLongSwipes = true;